#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>

typedef NS_ENUM(NSInteger, MRAnnotationStyle)
{
	MRAnnotationStyleFree		= 0,
	MRAnnotationStyleUser		,
	MRAnnotationStyleStart	,
	MRAnnotationStyleEnd		,
};

typedef struct {
	uint	b : 8;
	uint	g : 8;
	uint	r : 8;
	uint	a : 8;
} ARGBCOLOR;

#pragma mark - 标注
/*===================================================================
 说明:
	标注
 ==================================================================*/
@interface MRAnnotation : NSObject <MKAnnotation>
{
	NSTimer		*_timer;
	NSInteger	_count;
	
	CLLocationCoordinate2D		_start, _target;
}

+ (_Nonnull instancetype)annotationWithCoordinate:(CLLocationCoordinate2D)coordinate;
+ (_Nonnull instancetype)annotationWithCoordinate:(CLLocationCoordinate2D)coordinate style:(MRAnnotationStyle)style;

@property (nonatomic) NSInteger			tag;
@property (nonatomic) MRAnnotationStyle	style;
@property (nonatomic) BOOL				animatesDrop;

@property (nonatomic, copy, nullable)	NSString	*title;
@property (nonatomic, copy, nullable)	NSString	*subtitle;
@property (nonatomic, copy, nullable)	NSString	*text;
@property (nonatomic, copy, nullable)	UIColor		*color;

@property (nonatomic) CLLocationCoordinate2D	coordinate;
- (void)setCoordinate:(CLLocationCoordinate2D)coordinate animated:(BOOL)animated;

@end

#pragma mark - 标注视图
/*===================================================================
 说明:
	标注
 ==================================================================*/
@interface MRAnnotationView : MKAnnotationView
{
	NSTimer			*_timer;
	CAShapeLayer	*_aniLayer, *_bkLayer, *_cirLAyer;
	
	UIColor			*_color;
}

@property (nonatomic, strong, nonnull) MRAnnotation	*annotation;
@property (nonatomic, nullable) UILabel	*title;

+ (_Nonnull instancetype)reuseWithMapView:(MKMapView * _Nonnull)mapView reuseIdentifier:(NSString * _Nonnull)reuseIdentifier;

- (void)startAnimating;
- (void)stopAnimating;

@end

#pragma mark - 轨迹
/*===================================================================
 说明:
	轨迹
 ==================================================================*/
@interface MRPolyline : MKPolyline

@property (nonatomic) NSInteger		tag;

@property (nonatomic, nullable) ARGBCOLOR		*colors;

+ (_Nonnull instancetype)polylineWithCoordinates:(CLLocationCoordinate2D * _Nonnull)coords colors:(ARGBCOLOR * _Nonnull)colors count:(NSUInteger)count;

@end

#pragma mark - 轨迹视图
/*===================================================================
 说明:
	轨迹
 ==================================================================*/
@interface MRPolylineView : MKPolylineRenderer
{
	double			_distance;
}

@property (nonatomic, readonly, nonnull) MRPolyline	*polyline;

- (_Nonnull instancetype)initWithPolyline:(MRPolyline * _Nonnull)polyline;

@end

#pragma mark - 背景
/*===================================================================
 说明:
	背景层
 ==================================================================*/
@interface MRMapBackground : NSObject <MKOverlay>

- (_Nonnull instancetype)initWithColor:(UIColor * _Nonnull)color;

@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
@property (nonatomic, readonly) MKMapRect boundingMapRect;

@property (nonatomic, nullable) UIColor		*fillColor;

@end

@interface MRMapBackgroundView : MKOverlayRenderer

@property (nonatomic, strong, nullable) UIColor		*fillColor;

@end
